package com.openlogic.common.logic.decision.common.enums;

import com.openlogic.common.core.exception.logic.RuleException;

/**
* @ClassName: Logic
* @Description: ;逻辑表达式
* @author weiyongpeng
* @date 2024年9月30日 上午8:58:59
 */
public enum Logic {
	AND{
		@Override
		public String toString() {
			return "&&";
		}

		@Override
		public String toChnString() {
			return "并且";
		}
		
	},OR{
		@Override
		public String toString() {
			return "||";
		}
		
		@Override
		public String toChnString() {
			return "或者";
		}
	}, NOT{
		@Override
		public String toString() {
			return "!";
		}
		
		@Override
		public String toChnString() {
			return "非";
		}
	};
	
	public abstract String toChnString(); 
	
	public static Logic parse(String op){
		if(op.equals("&&")){
			return AND;
		}else if(op.equals("||")){
			return OR;
		}else if(op.equals("!")){
			return NOT;
		}
		throw new RuleException("Unsupport op "+op+"");
	}
}
